#include "gtest/gtest.h"

#include "predictor_target.h"
#include "predictor_link.h"

using namespace std;

TEST( Predictors, target )
{
  Predictor_base *p = new Predictor_target( "TEST" );

  Predictor_link *l_out = p->get_output_link();
  Predictor_link *l_target = p->get_input_link( 0 );
  Predictor_link *l_in = p->get_input_link( 1 );

  l_target->set_value( 2.2 );
  l_in->set_value( 2.2 );
  l_out->set_value( 1.2 );

  p->save_state( 1.0 );
  p->predict( 2.0 );
  ASSERT_NEAR( p->get_predicted_input(0), 2.2, 0.00001 );
  ASSERT_NEAR( p->get_predicted_input(1), 2.2, 0.00001 );

  p->predict( 2.5 );
  ASSERT_NEAR( 2.2, p->get_predicted_input(0), 0.00001 );
  ASSERT_NEAR( 2.2, p->get_predicted_input(1), 0.00001 );
}

